package com.dai.base;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.flowable.engine.repository.Deployment;
import org.junit.jupiter.api.Test;
@Slf4j
public class FlablableTestOne {
    private static final String url = "jdbc:mysql://localhost:3306/flowable?serverTimezone=UTC&nullCatalogMeansCurrent=true";
    /**
     *  @ClassName: FlablableTestOne
     *  @Description: 类描述:流程部署
     *  @date: 2025/6/12
     */
    @Test
    public void test(){
        System.out.println("我在测试");
        //流程引擎配置对象，关联相关配置源
        ProcessEngineConfiguration  cfg = new StandaloneProcessEngineConfiguration()
                .setJdbcUrl(url)
                .setJdbcDriver("com.mysql.cj.jdbc.Driver")
                .setJdbcUsername("root")
                .setJdbcPassword("123456")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        //获取流程引擎对象
        ProcessEngine processEngine = cfg.buildProcessEngine();
        System.out.println("我现在的对象是"+processEngine);
        //部署流程获取getRepositoryService，一次部署可以定义多次流程
        Deployment deploy = processEngine.getRepositoryService()
                .createDeployment()
                .addClasspathResource("process/one/FirstFlowable.bpmn20.xml")
                .name("第一个流程图")
                .deploy();
        log.info("我的流程图的id是{}",deploy.getId());
    }


}
